function generateMenu(){
	$.ajax({
		url:"/webapp/response/getrootmenu.json",
		type:'get',
		success:function(data){
			flag = true;
			$.each(data,function(i,e){
				$("#menu").accordion("add",{
				    title:e.text,
				    selected:flag,
				    content:"<ul class='easyui-tree' id='tree"+e.id+"' ></ul>"
			    });
			    //data-options=\"url:'/webapp/response/gettreemenu-"+e.id+".json',method:'get'\"
			    flag = false;
                //循环创建树的项
			    $.get("/webapp/response/gettreemenu-" + e.id + ".json", function (data) {
                        $("#tree" + e.id).tree({
                            data: data,
                            lines: true,
                            animate: true,
                            onClick: function (node) {
                                if (node.url) {
                                	var title = node.text;
                                	var href = node.url;
                                	var icon = node.icon|'default';
                                    addTab(title,href,icon);
                                } else {
                                    if (node.state == "closed") {
                                        $("#tree" + e.id).tree('expand', node.target);
                                    } else if (node.state == 'open') {
                                        $("#tree" + e.id).tree('collapse', node.target);
                                    }
                                }
                            }
                        });
                    }, 'json');
			});
			
		},
		error:function(xhr,status,error){

		}
	});
}

function getRootMenu(){
    return $("#menu").accordion("getSelected").panel("options").title;
}
function getSecondMenu(){
    return $("#tabs").tabs("getSelected").panel("options").title;
}